package com.powernode.exception;


import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice  //此注解对Controller异常处理
public class GlobalExceptionHandle {

    @ExceptionHandler(CartException.class)
    public ResponseEntity<Object> cartExceptionHandle(CartException cartException) {
        return ResponseEntity.badRequest().body(cartException.getMessage());
    }
}
